﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HikVisionTool.Helper
{
    public class Sql5Helper
    {
        private ConnectionConfig connection = null;
        public SqlSugarClient db = null;
        public Sql5Helper()
        {
            string SqlIP = "192.168.2.5";
            string database = "EdgeDB";
            string uid = "sa";
            string pwd = "8ik,9ol.";
            connection = new ConnectionConfig()
            {
                ConnectionString = "server='" + SqlIP + "';initial catalog='" + database + "';uid='" + uid + "';pwd='" + pwd + "'",
                DbType = DbType.SqlServer,
                IsAutoCloseConnection = true,
                InitKeyType = InitKeyType.Attribute
            };
            db = new SqlSugarClient(connection);
        }
        public bool SqlCheck()
        {
            try
            {
                db.Open();
                db.Close();
                db.Dispose();
                return true;
            }
            catch (Exception ee)
            {
                return false;
            }
        }
        #region t_org_tree
        [SugarTable("t_org_tree")]
        public class t_org_tree
        {
            public int id { get; set; }
            public string org_name { get; set; }
            public int parent_id { get; set; }
        }
        #endregion
        #region order_work
        [SugarTable("order_work")]
        public class order_work
        {
            public string number { get; set; }
            public string order_prod_number { get; set; }
            public string material_name { get; set; }
            public int plan_qty { get; set; }
        }
        #endregion
    }
}
